l4tab[l4_table_offset(LINEAR_PT_VIRT_START)] =
l4e_from_page(pg, __PAGE_HYPERVISOR);
l4tab[l4_table_offset(PERDOMAIN_VIRT_START)] =
- l4e_from_paddr(__pa(v->domain->arch.mm_perdomain_l3), __PAGE_HYPERVISOR);
+ l4e_from_paddr(__pa(v->domain->arch.mm_perdomain_l3),
+ __PAGE_HYPERVISOR);
v->arch.guest_table = pagetable_from_page(pg);
v->arch.guest_table_user = v->arch.guest_table;
static inline int may_switch_mode(struct domain *d)
{
- return (d->tot_pages == 0);
+ return (!is_hvm_domain(d) && (d->tot_pages == 0));
}
int switch_native(struct domain *d)
v->arch.perdomain_ptes =
d->arch.mm_perdomain_pt + (v->vcpu_id << GDT_LDT_VCPU_SHIFT);
- if ( IS_COMPAT(d) && (rc = setup_compat_l4(v)) != 0 )
- return rc;
-
- return 0;
+ return (pv_32on64_vcpu(v) ? setup_compat_l4(v) : 0);
}
void vcpu_destroy(struct vcpu *v)
{
- if ( IS_COMPAT(v->domain) )
+ if ( pv_32on64_vcpu(v) )
release_compat_l4(v);
}
free_domheap_page(virt_to_page(d->arch.mm_perdomain_l3));
#endif
- if ( IS_COMPAT(d) )
+ if ( pv_32on64_domain(d) )
release_arg_xlat_area(d);
free_xenheap_page(d->shared_info);
/* The context is a compat-mode one if the target domain is compat-mode;
* we expect the tools to DTRT even in compat-mode callers. */
- compat = IS_COMPAT(d);
+ compat = pv_32on64_domain(d);
#ifdef CONFIG_COMPAT
#define c(fld) (compat ? (c.cmp->fld) : (c.nat->fld))
else
#endif
{
- if ( supervisor_mode_kernel || is_hvm_vcpu(current) )
+ if ( supervisor_mode_kernel )
regs->eip &= ~31; /* re-execute entire hypercall entry stub */
for ( i = 0; *p != '\0'; i++ )
struct domain *d = v->domain;
unsigned long pfn;
-#ifdef CONFIG_COMPAT
- if ( IS_COMPAT(d) )
+#ifdef __x86_64__
+ if ( pv_32on64_vcpu(v) )
{
- if ( is_hvm_vcpu(v) )
- pfn = pagetable_get_pfn(v->arch.guest_table);
- else
- pfn = l4e_get_pfn(*(l4_pgentry_t *)
- __va(pagetable_get_paddr(v->arch.guest_table)));
+ pfn = l4e_get_pfn(*(l4_pgentry_t *)
+ __va(pagetable_get_paddr(v->arch.guest_table)));
if ( pfn != 0 )
{
put_page_and_type(mfn_to_page(pfn));
}
- if ( is_hvm_vcpu(v) )
- v->arch.guest_table = pagetable_null();
- else
- l4e_write(
- (l4_pgentry_t *) __va(pagetable_get_paddr(v->arch.guest_table)),
- l4e_empty());
+ l4e_write(
+ (l4_pgentry_t *)__va(pagetable_get_paddr(v->arch.guest_table)),
+ l4e_empty());
v->arch.cr3 = 0;
return;
int i;
#else
- if ( !pv_32bit_guest(v) )
+ if ( !pv_32bit_vcpu(v) )
return;
#endif
l4e = sh_map_domain_page(m4mfn);
l4e[0] = l4e_from_pfn(mfn_x(m3mfn), __PAGE_HYPERVISOR);
sh_unmap_domain_page(l4e);
- if ( pv_32bit_guest(v) )
+ if ( pv_32bit_vcpu(v) )
{
// Install a monitor l2 table in slot 3 of the l3 table.
// This is used for all Xen entries.
l4_pgentry_t *l4e = sh_map_domain_page(mmfn);
ASSERT(l4e_get_flags(l4e[0]) & _PAGE_PRESENT);
m3mfn = _mfn(l4e_get_pfn(l4e[0]));
- if ( pv_32bit_guest(v) )
+ if ( pv_32bit_vcpu(v) )
{
/* Need to destroy the l2 monitor page in slot 3 too */
l3_pgentry_t *l3e = sh_map_domain_page(m3mfn);
#include <asm/hvm/domain.h>
#include <asm/e820.h>
+#ifdef __x86_64__
+#define pv_32bit_vcpu(v) (!is_hvm_vcpu(v) && IS_COMPAT((v)->domain))
+#define pv_32bit_domain(d) (!is_hvm_domain(d) && IS_COMPAT(d))
+#define pv_32on64_vcpu(v) (pv_32bit_vcpu(v))
+#define pv_32on64_domain(d) (pv_32bit_domain(d))
+#else
+#define pv_32bit_vcpu(v) (!is_hvm_vcpu(v))
+#define pv_32bit_domain(d) (!is_hvm_domain(d))
+#define pv_32on64_vcpu(v) (0)
+#define pv_32on64_domain(d) (0)
+#endif
+
+
struct trap_bounce {
uint32_t error_code;
uint8_t flags; /* TBF_ */